<?PHP
defined('_XR_EXEC') or die();
/**
 * 控制器处理类 
 */
class huodong_controller extends controller{
	var $pagelist = 20;
	function __construct(){
		parent::__construct();
	 	$this->assign('menuid','7');
	 	$this->assign('pagetopimg','huodong.jpg'); 
	}
 #促销活动
	public function cuxiao__(){
	  $pentype_id = '2';
		$_GET=format::addslash_deep($_GET);
		# 本身类别
		$db = factory::getDBO();
		# 总数
		$where = ' where a.pentype_id = "'.$pentype_id.'" and a.deleted=0 and a.publishs=1 ' ;
		 
		# 得到详细数据
		$rs_list = $db->loadassoclist('
			select 
			a.*
			from `t_pen` a 
		'.$where.' order by a.id desc '); 
		if(count($rs_list) > 0){
			$rs_one = $rs_list[0];
		}else{
			$rs_one = array();
		}
		$this->assign('rs_list',$rs_list); 
		$this->assign('rs_one',$rs_one); 
	  
		
	}

	#主题活动
	public function zhuti__(){
	  $pentype_id = '4';
		$_GET=format::addslash_deep($_GET);
		# 本身类别
		$db = factory::getDBO();
		# 总数
		$where = ' where a.pentype_id = "'.$pentype_id.'" and a.deleted=0 and a.publishs=1 ' ;
		 
		# 得到详细数据
		$rs_list = $db->loadassoclist('
			select 
			a.*
			from `t_pen` a 
		'.$where.' order by a.id desc ');  
		$this->assign('rs_list',$rs_list);  
	}
	#主题活动显示
	public function zhutishow__(){
		$_GET=format::addslash_deep($_GET);
		$id = intval($_GET['id']);
		$db = factory::getDBO();
		$rs = $db->loadassoc('select a.* from `t_pen` a  where deleted=0 and a.publishs=1 and a.pentype_id=4 and a.id="'.$id.'" ');
		if(!$rs){
			url::jump('/home/index');
		}
		$this->assign('rs',$rs);
		/* 计数 */
		$db->query('update `t_pen` set showcount=showcount+1  where id="'.$id.'"');
		
	}

	#期刊杂志
	public function zazhi__(){
	  $pentype_id = '3';
		$_GET=format::addslash_deep($_GET);
		# 本身类别
		$db = factory::getDBO();
		# 总数
		$where = ' where a.pentype_id = "'.$pentype_id.'" and a.deleted=0 and a.publishs=1 ' ;
		 
		# 得到详细数据
		$rs_list = $db->loadassoclist('
			select 
			a.*
			from `t_pen` a 
		'.$where.' order by a.id desc '); 
		if(count($rs_list) > 0){
			$rs_one = $rs_list[0];
		}else{
			$rs_one = array();
		}
		$this->assign('rs_list',$rs_list); 
		$this->assign('rs_one',$rs_one); 
	  
		
	}
	
	 
}
?>